﻿using Hotel.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hotel.DAL
{
    public class ShopDAL
    {
        public ShopDAL(HotelConText hotelConText) 
        {
            HotelConText = hotelConText;
        }

        public HotelConText HotelConText { get; }



        /// <summary>
        /// 添加门店
        /// </summary>
        /// <param name="shopModel"></param>
        /// <returns></returns>
        public int ShopAdd(ShopModel shopModel) 
        {
            HotelConText.shops.Add(shopModel);
            return HotelConText.SaveChanges();
        }




        /// <summary>
        /// 门店不能重复
        /// </summary>
        /// <param name="shopName"></param>
        /// <returns></returns>

        public int SearchShopName( string shopName) 
        {
            int res= HotelConText.shops.Where(x=>x.ShopName==shopName).Count();
            return res;
        }
























    }
}
